<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>三角效果</title>
    <style>
        div {
            position: relative;
            border: 1px solid #000000;
            width: 300px;
            height: 30px;
        }
        
        div::before {
            content: "";
            position: absolute;
            width: 12px;
            height: 12px;
            border-right: 1px solid #000000;
            border-bottom: 1px solid #000000;
            top: 5px;
            right: 5px;
            transform: rotate(45deg);
            transition: all 01s;
        }
        
        div:hover::before {
            transform: rotate(225deg);
        }
    </style>
</head>

<body>
    <div></div>
</body>

</html>